﻿<!DOCTYPE html>
<html>
<head>
    <title>列表</title>
    <link href="/static/css/framework-font.css" rel="stylesheet"/>
    <script src="/static/js/jquery-2.1.1.js"></script>
    <script src="/static/bootstrap/js/bootstrap.js"></script>
    <link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
    <script src="/static/js/jquery.cookie.js"></script>
    <link href="/static/css/framework-theme.css" rel="stylesheet"/>
    <script src="/static/js/framework-ui.js"></script>
    <script src="/static/js/framework-clientdata.js"></script>
    <script src="/static/js/yii.js"></script>

    <!--引用layui弹框插件-->
    <link href="/static/layui/css/layui.css" rel="stylesheet"/>
    <script src="/static/layui/layui.js"></script>
    <link href="/static/css/pattern/public.css" rel="stylesheet"/>
</head>
<body>
<style>
    .form-horizontal .control-label {
        display: inline-block;
        width: 10%;
        text-align: justify !important;
        text-align-last: justify; /*解决IE的支持*/
    }

    .title {
        font-size: 16px;
        background-color: #fff;
        margin: 15px 0px;
        line-height: 45px;
        padding-left: 20px;
    }
</style>
<div class="newtest">

    <div class="new_main">

        <script type="text/html" id="toolbarDemo">
            <div class="layui-btn-container">
                <a class="layui-btn-sm layui-btn layui-btn-danger" lay-event="getCheckLength">批量删除</a>
            </div>
        </script>

        <table class="layui-hide" id="progress" lay-filter="progress"></table>


        <script type="text/html" id="toolpro">
            <a class="layui-btn layui-btn-sm" lay-event="detail">查看详情</a>
            <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</button>
        </script>

    </div>
</div>
<script src="/static/js/index.js"></script>
<script src="/static/js/indextab.js"></script>
<script src="/static/js/pace.min.js"></script>
<!--弹框js-->
<script src="/static/js/yii.js"></script>
<script>

    layui.use(['form', 'jquery', 'layer', 'laydate', 'table'], function () { //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer;
        var form = layui.form;
        var laydate = layui.laydate;
        var table = layui.table //表格
        //日期范围
        var pro_id = {$pro_id};
        var group = {$group};
        var url = "{:URL('project/Progress/index')}"
        var where = {'type': "list", 'pro_id': pro_id, 'group': group};
        var title = "列表";
        var cols = [[
            {type: 'checkbox', fixed: 'left'}
            , {field: 'work', title: '总体进展情况', align: 'center'}
            // , {field: 'progress', title: '目前进度情况', align: 'center'}
            , {field: 'addtime', title: '提交时间', align: 'center'}
            , {fixed: 'right', title: '操作', align: 'center', toolbar: '#toolpro'}
        ]];
        showlist(table, url, where, title, cols, [10, 20, 50, 100, 200, 500, 1000], 10, '#progress', '#toolbarDemo', 1, false);


        //头工具栏事件
        table.on('toolbar(progress)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
            switch (obj.event) {
                case 'getCheckLength':
                    var data = checkStatus.data;
                    var id = [];
                    for (var i = 0; i < data.length; i++) {
                        id[i] = data[i].id;
                    }
                    if (id.length == 0) {
                        layer.alert("请选择需操作的数据");
                        return;
                    }

                    layer.confirm('是否确定操作?', function (index) {
                        let url = "{:URL('project/Progress/del')}";
                        let where = {id: id};
                        publicDel(table, url, where, obj, index, 1,"progress");
                    });
                    break;
            }
        });

        //监听行工具事件
        table.on('tool(progress)', function (obj) {
            var id = obj.data.id;
            switch (obj.event) {
                case 'detail':
                    var showUrl = "{:URL('project/Progress/detail')}?id=" + id;
                    showView(showUrl);
                    break;
                case 'del':
                    layer.confirm('是否确定操作?', function (index) {
                        let url = "{:URL('project/Progress/del')}";
                        let where = {id: id};
                        publicDel(table, url, where, obj, index, 0);
                    });
                    break;
            }

        });


        //查看详情视图
        function showView(showUrl, title = "详情") {
            layer.open({
                type: 2,
                skin: 'layui-layer-demo', //样式类名
                area: ['700px', '500px'],            //宽度450px,高自适应
                anim: 2,
                shadeClose: false, //开启遮罩关闭,
                maxmin: true,
                title: title,
                content: showUrl,
                btn: ['确定', '取消'],
                yes: function (index) {
                    layer.close(index);
                },
            });
        }


    });
</script>
</body>
</html>
